package com.menu.Controller;

import com.menu.Service.ThumbsUpService;
import com.menu.Utils.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags = "点赞接口")
@RestController
@RequestMapping("/User")
public class ThumbsUpController {
    @Resource
    ThumbsUpService thumbsUpService;



    @ApiOperation(value = "点赞功能")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "userId", value = "用户id", required = true),
                    @ApiImplicitParam(name = "menuId", value = "食谱id", required = true)
            }
    )
    @PostMapping("/thumbsUp")
    public ResponseResult thumbsUp(Integer userId, Integer menuId){
        return thumbsUpService.thumbsUp(userId,menuId);
    }



    @ApiOperation(value = "判断是否点赞")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "userId", value = "用户id", required = true),
                    @ApiImplicitParam(name = "menuId", value = "食谱id", required = true)
            }
    )
    @PostMapping("/judgeOfThumbsUp")
    public ResponseResult judgeOfThumbsUp(Integer userId, Integer menuId){
        return thumbsUpService.judgeOfThumbsUp(userId,menuId);
    }


}

